package com.magenta.maxoptra.yournavigation.org;

/**
 * Project: Santa-cruz
 * Author:  Irina Isaeva
 * Created: 09.06.12 11:12
 * <p/>
 * Copyright (c) 1999-2012 Magenta Corporation Ltd. All Rights Reserved.
 * Magenta Technology proprietary and confidential.
 * Use is subject to license terms.
 * <p/>
 * $Id$
 */
public class TrafficRoadImpl implements TrafficRoad {
    private String distance;
    private String time;

    @Override
    public double getDistance() {
        if (distance.isEmpty()) {
            return 0;
        } else {
            return Double.parseDouble(distance);
        }
    }

    @Override
    public void setDistance(String distance) {
        this.distance = distance;
    }

    @Override
    public double getTime() {
        if (time.isEmpty()) {
            return 0;
        } else {
            return Long.parseLong(time);
        }
    }

    @Override
    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public boolean emptyDistance() {
        return distance == null;
    }

    @Override
    public boolean emptyTime() {
        return time == null;
    }
}

